import React, { Fragment } from 'react';
import * as lodash from 'lodash';
import { Button, Checkbox, message, Select, Radio } from 'antd';
const CheckboxGroup = Checkbox.Group;
import { WeaDialog, WeaSearchGroup, WeaFormItem, WeaInput, WeaSelect, WeaBrowser, WeaCheckbox, WeaUpload, WeaInputNumber, WeaHelpfulTip } from 'ecCom';
import { WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EField_New from './base/EField_New';
import EOrderCol from './base/EOrderCol';
import './Style_7.css';
import { EchartColorScheme } from '../../echart/';
// 文档中心，数据来源
class Content_odocCenter_DataSource extends React.Component {

    state = {
        id: this.props.tabData.id,
        // 通用设置项
        title: this.props.tabData.title || '',
        showType: this.props.tabData.showType || '0',//列表---内容类型

        // 公文列表元素设置项
        eFieldNewDataSource: this.props.tabData.eFieldNewDataSource || this.props.tabNew.eFieldNewDataSource,//显示字段
        eFieldNewUsedKeys: this.props.tabData.eFieldNewUsedKeys || [],//显示字段
        odocLinkColorScheme: this.props.tabData.odocLinkColorScheme || '0',//公文环节显示配色方案(新增
        orderColUsedKeys: this.props.tabData.orderColUsedKeys || [],//排序字段
        orderColDataSource: lodash.isEmpty(this.props.tabData.orderColDataSource) ? this.props.tabNew.orderColDataSource : this.props.tabData.orderColDataSource,//排序字段
        // displayHeader: this.props.tabData.displayHeader || '0',//显示表头（新增
        tableType: this.props.tabData.tableType || '0',//显示方式（新增
        officalType: this.props.tabData.officalType || '0',//公文类型
        listType: this.props.tabData.listType || '0',//列表类型（新增
        dealType: this.props.tabData.dealType || '0',//查看类型
        workflowSource: this.props.tabData.workflowSource || '0',//流程来源（新增
        workFlowId: this.props.tabData.workFlowId || '',//流程来源
        workFlowIdName: this.props.tabData.workFlowIdName || [],//流程来源
        odocSource: this.props.tabData.odocSource || '0',//公文来源（新增
        doccategory: this.props.tabData.doccategory || "",//公文来源目录
        doccategoryNames: this.props.tabData.doccategoryNames || "",//公文来源目录

        // 公文库统计设置项
        odocProcess: this.props.tabData.odocProcess || '1,2,3',//公文过程（新增
        odocDateType: this.props.tabData.odocDateType || '',//时间维度

        // 用印归档统计设置项
        odocLinkType: this.props.tabData.odocLinkType || '1,2',//统计环节
        imgLeft: this.props.tabData.imgLeft || '0',//显示方式（新增
        iconImgsrc: this.props.tabData.iconImgsrc || '',//统计项图标
        printImgsrc: this.props.tabData.printImgsrc || '',//用印图片
        endImgsrc: this.props.tabData.endImgsrc || '',//归档图片
        merge: this.props.tabData.merge || '0',//统计方式（新增
        defaultBranches: this.props.tabData.defaultBranches || '3',//默认显示条数

        // 公文办理设置项
        chartType: this.props.tabData.chartType || '0',//展示类型
        tiltShow: this.props.tabData.tiltShow || '0',//坐标轴文字倾斜显示（新增
        odocColorScheme: this.props.tabData.odocColorScheme || '0',//配色方案（新增
        showLegend: this.props.tabData.showLegend || '1',//显示图例（新增

        odocType: this.props.tabData.odocType || '0',//
        orderColVisible: false,//
        // importFileList: this.props.tabData.importFileList || [],//统计项图标(18*18px)（新增
        // importFileList1: this.props.tabData.importFileList1 || [],//用印统计图片（新增
        // importFileList2: this.props.tabData.importFileList2 || [],//归档 统计图片（新增

        //基础参数
        eid: this.props.eid,
        hpid: this.props.hpid,
        subCompanyId: this.props.subCompanyId,
    };

    constructor(props) {
        super(props);
        this.getButtons = this.getButtons.bind(this);
        this.onDocSourceTypeChange = this.onDocSourceTypeChange.bind(this);
        this.onOk = this.onOk.bind(this);
        this.onCancel = this.onCancel.bind(this);
        this.onChangeSize = this.onChangeSize.bind(this);
    }

    render() {
        const { eid, hpid, subCompanyId, title = "", officalType, dealType, odocType, showType, orderColVisible, eFieldNewVisible, orderColUsedKeys, 
            orderColDataSource, eFieldNewDataSource, eFieldNewUsedKeys, odocDateType, odocLinkType, chartType,
            workFlowId, workFlowIdName, doccategoryNames, displayHeader, odocSource, odocProcess, odocColorScheme,
            tableType, listType, workflowSource, tiltShow, showLegend, imgLeft, iconImgsrc, printImgsrc, endImgsrc, merge, defaultBranches, odocLinkColorScheme } = this.state;
        const { tabNew = {} } = this.props;
        const { dealTypeOption = [], officalTypeOption = {}, showTypeOption, odocDateTypeOption, odocLinkTypeOption, openYozoOrWps, odocLinkColorSchemeOptions = [], odocColorSchemeOptions = [] } = tabNew;
        const { odocType: odocTypeOption } = dealTypeOption;
        const dealTypeOptions2 = dealTypeOption[odocType][0];
        const dealTypeOptions3 = dealTypeOption.odocType;
        const dealTypeOptions4 = [
            { key: "0", showname: getLabel(332, '全部') },
            { key: "1", showname: getLabel(19214, '选择目录') },
        ]
        const dealTypeOptions5 = [
            { key: "0", showname: getLabel(332, '全部') },
            { key: "1", showname: getLabel(385227, '选择路径') },
        ];

        const eFieldNewUsedNames = [];
        for (let i = 0; i < eFieldNewUsedKeys.length; i++) {
            for (let j = 0; j < eFieldNewDataSource.length; j++) {
                if (eFieldNewUsedKeys[i] == eFieldNewDataSource[j].key) {
                    eFieldNewUsedNames.push(eFieldNewDataSource[j].name);
                }
            }
        }
        let showOdocColor = false;
        eFieldNewUsedNames.length > 0 && eFieldNewUsedNames.forEach(data => {
            if (data == getLabel(383476, '公文环节') || data == "Document Node  ") {
                showOdocColor = true;
            }
        })


        let EFieldNew = <div></div>;
        if (eFieldNewVisible) {
            const eFieldNewProps = {
                eFieldNewDataSource: _.cloneDeep(eFieldNewDataSource),
                eFieldNewUsedKeys: _.cloneDeep(eFieldNewUsedKeys),
                onOk: (data) => {
                    this.setState({
                        eFieldNewDataSource: _.cloneDeep(data.eFieldNewDataSource),
                        eFieldNewUsedKeys: _.cloneDeep(data.eFieldNewUsedKeys),
                        eFieldNewVisible: false
                    });
                },
                onCancel: () => {
                    this.setState({
                        eFieldNewVisible: false
                    });
                }
            };
            EFieldNew = <EField_New ecId={`${this && this.props && this.props.ecId || ''}_EField_New@hc9abp`} {...eFieldNewProps} />
        }


        let orderColComp = <div></div>;
        if (orderColVisible) {
            const orderColProps = {
                orderColDataSource: _.cloneDeep(orderColDataSource),
                orderColUsedKeys: _.cloneDeep(orderColUsedKeys),
                onOk: (data) => {
                    this.setState({
                        orderColDataSource: data.orderColDataSource,
                        orderColUsedKeys: data.orderColUsedKeys,
                        orderColVisible: false
                    });
                },
                onCancel: () => {
                    this.setState({
                        orderColVisible: false
                    });
                }
            };
            orderColComp = <EOrderCol ecId={`${this && this.props && this.props.ecId || ''}_EOrderCol@ikwx2x`} {...orderColProps} />
        }


        const orderColUsedNames = [];
        for (let i = 0, len = orderColUsedKeys.length; i < len; i++) {
            for (let j = 0, len2 = orderColDataSource.length; j < len2; j++) {
                if (orderColUsedKeys[i] == orderColDataSource[j].key) {
                    orderColUsedNames.push(orderColDataSource[j].fieldName + '-' + (orderColDataSource[j].orderType == '0' ? getLabel(340, '降序') : getLabel(339, '升序')));
                }
            }
        }

        return (
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@xv8y8b`}
                className="portal-esetting-dialog portal-odoccenter-esetting-dialog"
                visible={true}
                title={getLabel(19480, '内容设置')}
                icon="icon-coms-portal"
                iconBgcolor='#1a57a0'
                style={{ width: 660, height: 507 }}
                hasScroll={true}
                buttons={this.getButtons()}
                onCancel={this.onCancel}
            >
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@3uw0b7`} title={getLabel(33396, '设置项')} needTigger={true} showGroup={true}>
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@8pldq5`} label={getLabel(24986, '标题')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@oa8gz3`} inputType="multilang" isBase64={true} value={title} viewAttr={3} onChange={value => this.setState({ title: value })} />
                    </WeaFormItem>
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@83mimp`} label={getLabel(524504, '内容类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@9663s1`}
                            options={Object.keys(showTypeOption).map(function (el) {
                                return { key: el, showname: showTypeOption[el] };
                            })}
                            value={showType}
                            onChange={value => {
                                this.setState({ showType: value, workFlowIdName: [], workFlowId: '' });
                            }}
                        />
                    </WeaFormItem>
                    {
                        showType == '0' && <div>
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@qoz4na`} label={getLabel(19495, '显示字段')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                {EFieldNew}
                                <div style={{ height: '100%', lineHeight: '23px' }}>
                                    <i className="icon-coms-Flow-setting portal-esetting-btn"
                                        style={{ position: "relative", zIndex: "12", top: 5 }}
                                        onClick={() => this.setState({ eFieldNewVisible: true })} />
                                    <span><img style={{ position: 'relative', zIndex: '12', top: 3, display: eFieldNewUsedNames.length > 0 ? 'none' : '' }} src="/images/BacoError_wev9.png" align="absmiddle" /></span>
                                    <div
                                        title={eFieldNewUsedNames.join('，')} style={{
                                            marginTop: -18, "-webkit-line-clamp": 2,
                                            "-webkit-box-orient": "vertical", "cursor": "pointer"
                                        }}>&nbsp;&nbsp;&nbsp;&nbsp;{eFieldNewUsedNames.join('，')}</div>
                                </div>
                            </WeaFormItem>
                            {showOdocColor && <EchartColorScheme ecId={`${this && this.props && this.props.ecId || ''}_EchartColorScheme@xmc4x6`} ref={'odocLinkColorScheme'} options={odocLinkColorSchemeOptions} moduleType='odocCenter' value={odocLinkColorScheme} eid={eid} hpid={hpid} subCompanyId={subCompanyId} />}
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@ncdlbd`} label={getLabel(15512, '排序字段')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                {orderColComp}
                                <div style={{ height: '100%', lineHeight: '23px' }}>
                                    <i className="icon-coms-Flow-setting portal-esetting-btn" style={{ position: "relative", zIndex: "12", top: 5 }} onClick={() => this.setState({ orderColVisible: true })} />
                                    <div title={orderColUsedNames.join('，')} style={{ marginTop: -18, "-webkit-box-orient": "vertical", "cursor": "pointer", "-webkit-line-clamp": 2, }}>&nbsp;&nbsp;&nbsp;&nbsp;{orderColUsedNames.join('，')}</div>
                                </div>
                            </WeaFormItem>
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@ic3n14`} label={getLabel(21653, '显示方式')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <div style={{ display: 'inline-block', width: '160px' }}>
                                    {openYozoOrWps ?
                                        <Select ecId={`${this && this.props && this.props.ecId || ''}_Select@dctlbs`} ref="fillStyleSelect" size='large'
                                            className="eStyle-7 wea-select eeStyle-7"
                                            dropdownClassName="droptwo"
                                            dropdownMatchSelectWidth={true}
                                            onChange={value => {
                                                this.setState({
                                                    tableType: value,
                                                    topStyle: ''
                                                });
                                            }} style={{ width: '175px' }} value={tableType}>
                                            <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@bg5x6j`} className={'portal-imgSlide-images-option'} value="0">
                                                <div className="portal-imgSlide-images-style-content-type" title={getLabel('517607', '单行列表')}>
                                                    <img className="portal-imgSlide-images-style-content-image" style={{ marginRight: '15px' }} src="/spa/portal/images/news/odocSingleList.png" alt="" />
                                                    <span className="portal-imgSlide-images-style-content-span">{getLabel('517607', '单行列表')}</span>
                                                </div>
                                            </Option>
                                            <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@5x1n8u`} className={'portal-imgSlide-images-option'} value="1">
                                                <div className="portal-imgSlide-images-style-content-type" title={getLabel('517578', '双行列表')}>
                                                    <img className="portal-imgSlide-images-style-content-image" src="/spa/portal/images/news/odocDoubleList.png" alt="" />
                                                    <span className="portal-imgSlide-images-style-content-span">{getLabel('517578', '双行列表')}</span>
                                                </div>
                                            </Option>
                                            <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@05ck6f`} className={'portal-imgSlide-images-option'} value="2">
                                                <div className="portal-imgSlide-images-style-content-type" title={getLabel('524302', "正文缩略图")}>
                                                    <img className="portal-imgSlide-images-style-content-image" src="/spa/portal/images/news/odocContent.png" alt="" />
                                                    <span className="portal-imgSlide-images-style-content-span">{getLabel('524302', "正文缩略图")}</span>
                                                </div>
                                            </Option>
                                        </Select>
                                        :
                                        <Select ecId={`${this && this.props && this.props.ecId || ''}_Select@33ktnh`} ref="fillStyleSelect" size='large'
                                            className="eStyle-7 wea-select eeStyle-7"
                                            dropdownClassName="droptwo"
                                            dropdownMatchSelectWidth={true}
                                            onChange={value => {
                                                this.setState({
                                                    tableType: value,
                                                    topStyle: ''
                                                });
                                            }} style={{ width: '175px' }} value={tableType}>
                                            <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@o4l6xo`} className={'portal-imgSlide-images-option'} value="0">
                                                <div className="portal-imgSlide-images-style-content-type" title={getLabel('517607', '单行列表')}>
                                                    <img className="portal-imgSlide-images-style-content-image" style={{ marginRight: '15px' }} src="/spa/portal/images/news/odocSingleList.png" alt="" />
                                                    <span className="portal-imgSlide-images-style-content-span">{getLabel('517607', '单行列表')}</span>
                                                </div>
                                            </Option>
                                            <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@qkxqmf`} className={'portal-imgSlide-images-option'} value="1">
                                                <div className="portal-imgSlide-images-style-content-type" title={getLabel('517578', '双行列表')}>
                                                    <img className="portal-imgSlide-images-style-content-image" src="/spa/portal/images/news/odocDoubleList.png" alt="" />
                                                    <span className="portal-imgSlide-images-style-content-span">{getLabel('517578', '双行列表')}</span>
                                                </div>
                                            </Option>
                                        </Select>
                                    }
                                </div>
                            </WeaFormItem>
                        </div>
                    }
                    {
                        showType == '1' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@jx94xb`} label={getLabel('34161', '公文过程')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                            <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@0gm37l`}
                                detailtype={2}
                                options={Object.keys(officalTypeOption).map(function (el) {
                                    return { key: el, showname: officalTypeOption[el] };
                                }).slice(1)}
                                value={odocProcess}
                                onChange={value => {
                                    this.setState({ odocProcess: value });
                                }}
                            />
                        </WeaFormItem>
                    }
                    {
                        showType == '1' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@5hz9d7`} label={getLabel('524303', '时间维度')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                            <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@op9bc5`}
                                multiple
                                viewAttr={3}
                                options={Object.keys(odocDateTypeOption).map(function (el) {
                                    return { key: el, showname: odocDateTypeOption[el] };
                                })}
                                value={odocDateType}
                                onChange={value => {
                                    this.setState({ odocDateType: value });
                                }}
                            />
                        </WeaFormItem>
                    }
                    {
                        showType == '2' && <div>
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@k9lbo1`} label={getLabel('524304','统计环节')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@56ntan`}
                                    detailtype={2}
                                    viewAttr={3}
                                    options={Object.keys(odocLinkTypeOption).map(function (el) {
                                        return { key: el, showname: odocLinkTypeOption[el] }
                                    })}
                                    value={odocLinkType}
                                    onChange={value => {
                                        this.setState({ odocLinkType: value });
                                    }}
                                />
                            </WeaFormItem>
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@j0pjva`} label={getLabel(21653, '显示方式')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <div style={{ display: 'inline-block', width: '160px' }}>
                                    <Select ecId={`${this && this.props && this.props.ecId || ''}_Select@tl34ko`} ref="fillStyleSelect" size='large'
                                        className="eStyle-7 wea-select eeStyle-7"
                                        dropdownClassName="droptwo"
                                        dropdownMatchSelectWidth={true}
                                        onChange={value => {
                                            this.setState({
                                                imgLeft: value,
                                            });
                                        }}
                                        style={{ width: '175px' }}
                                        value={imgLeft}
                                    >
                                        <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@n8603n`} className={'portal-imgSlide-images-option'} value="0">
                                            <div className="portal-imgSlide-images-style-content-type" title={getLabel('82759', '左图式')}>
                                                <img className="portal-imgSlide-images-style-content-image" style={{ marginRight: '15px' }} src="/spa/portal/images/news/odocLeftStyle.png" alt="" />
                                                <span className="portal-imgSlide-images-style-content-span">{getLabel('82759', '左图式')}</span>
                                            </div>
                                        </Option>
                                        <Option ecId={`${this && this.props && this.props.ecId || ''}_Option@3v7u8q`} className={'portal-imgSlide-images-option'} value="1">
                                            <div className="portal-imgSlide-images-style-content-type" title={getLabel('', '右图式')}>
                                                <img className="portal-imgSlide-images-style-content-image" src="/spa/portal/images/news/odocRightStyle.png" alt="" />
                                                <span className="portal-imgSlide-images-style-content-span">{getLabel('', '右图式')}</span>
                                            </div>
                                        </Option>
                                    </Select>
                                </div>
                            </WeaFormItem>
                            {odocLinkType.indexOf('1') != '-1' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@lwliot`} label={getLabel('524305', '用印统计图片')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }} className='uploadItem'>
                                <WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@ly0x0q`}
                                    uploadId="noticeUpload"
                                    maxFilesNumber='1'
                                    uploadUrl="/api/portal/noticeadd/uploadImg"
                                    category="0"
                                    viewAttr="2"
                                    multiSelection={false}
                                    limitType="png,gif,jpeg,jpg,bmp"
                                    onChange={(ids, list) =>
                                        this.setState({
                                            printImgsrc: list[0].filelink
                                        })
                                    }
                                    showClearAll={true}
                                >
                                    {printImgsrc ?
                                        <Fragment ecId={`${this && this.props && this.props.ecId || ''}_Fragment@2oqgm0`}> <img src={printImgsrc} title={getLabel(124841, "添加图片")} height='50px' alt="" />
                                            {/* <i title='删除' onClick={() => { this.setState({ printImgsrc: '' }) }} className="icon-coms02-Delete del" /> */}
                                        </Fragment> : <i className="icon-coms-AddTo add" />}
                                </WeaUpload>{printImgsrc ? '' : <span className='tip'>{getLabel('524306','不设置为使用默认图片')}</span>}
                            </WeaFormItem>}
                            {odocLinkType.indexOf('2') != '-1' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@r1eczh`} label={getLabel('524307', '归档统计图片')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }} className='uploadItem'>
                                <WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@8k44gq`}
                                    uploadId="noticeUpload"
                                    maxFilesNumber='1'
                                    uploadUrl="/api/portal/noticeadd/uploadImg"
                                    category="0"
                                    viewAttr="2"
                                    multiSelection={false}
                                    limitType="png,gif,jpeg,jpg,bmp"
                                    onChange={(ids, list) =>
                                        this.setState({
                                            endImgsrc: list[0].filelink
                                        })
                                    }
                                    showClearAll={true}
                                >
                                    {endImgsrc ?
                                        <Fragment ecId={`${this && this.props && this.props.ecId || ''}_Fragment@6azygw`}> <img src={endImgsrc} title={getLabel(124841, "添加图片")} height='50px' alt="" />
                                            {/* <i title='删除' onClick={() => { this.setState({ endImgsrc: '' }) }} className="icon-coms02-Delete" /> */}
                                        </Fragment> : <i className="icon-coms-AddTo add" />}
                                </WeaUpload>{endImgsrc ? '' : <span className='tip'>{getLabel('524306','不设置为使用默认图片')}</span>}
                            </WeaFormItem>}
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@3k3wdh`} label={getLabel('384246', '统计方式')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@3tcmk2`}
                                    detailtype={3}
                                    options={[
                                        {
                                            key: "0",
                                            selected: true,
                                            showname: getLabel(524308,'合并统计'),
                                        }, {
                                            key: "1",
                                            selected: false,
                                            showname: getLabel(524309,'按路径拆分'),
                                        },
                                    ]}
                                    value={merge}
                                    onChange={value => {
                                        this.setState({ merge: value });
                                    }}
                                />
                            </WeaFormItem>
                            {merge == '1' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@9dpkl8`} label={getLabel('506911', '默认显示条数')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaInputNumber ecId={`${this && this.props && this.props.ecId || ''}_WeaInputNumber@wuasck`}
                                    value={defaultBranches}
                                    min={1}
                                    onChange={value =>
                                        this.setState({
                                            defaultBranches: value
                                        })
                                    }
                                />
                            </WeaFormItem>}
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@lfwzke`} label={getLabel('21672','流程来源')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@adr5jk`}
                                    options={dealTypeOptions5}
                                    value={this.state.workflowSource}
                                    onChange={value => {
                                        this.setState({ workflowSource: value });
                                    }}
                                />
                                {workflowSource == '1' && <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@bbdkcm`}
                                    style={{ marginTop: 10 }}
                                    viewAttr={3}
                                    type={'odocFlow'}
                                    title={getLabel(386382, '请选择')}
                                    isSingle={false}
                                    replaceDatas={workFlowIdName}
                                    onChange={(ids, names, datas) => this.setState({ workFlowId: ids, workFlowIdName: datas })}
                                    layout={document.body}
                                />}
                            </WeaFormItem>
                        </div>
                    }
                    {
                        showType == '3' && <div>
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@cj4fvv`} label={getLabel('501240','展示类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@gbd6az`}
                                    options={[
                                        {
                                            key: "0",
                                            selected: true,
                                            showname: getLabel('384602','柱状图'),
                                        }, {
                                            key: "1",
                                            selected: true,
                                            showname: getLabel('128841','饼状图'),
                                        }, {
                                            key: "2",
                                            selected: true,
                                            showname: getLabel('524310','环状图'),
                                        },
                                    ]}
                                    value={chartType}
                                    onChange={value => {
                                        this.setState({ chartType: value });
                                    }}
                                />
                            </WeaFormItem>
                            {/* {chartType == '0' && <WeaFormItem label={getLabel(516815, '坐标轴文字倾斜显示')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaCheckbox
                                    display="switch"
                                    value={tiltShow}
                                    onChange={(v) => { this.setState({ tiltShow: v }) }}
                                />
                            </WeaFormItem>} */}
                            <EchartColorScheme ecId={`${this && this.props && this.props.ecId || ''}_EchartColorScheme@wf3en0`} ref={'odocColorScheme'} options={odocColorSchemeOptions} moduleType='odocConten' value={odocColorScheme} eid={eid} hpid={hpid} subCompanyId={subCompanyId} />
                            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@njfjni`} label={getLabel(515935, '显示图例')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                                <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@wcatpq`}
                                    display="switch"
                                    value={showLegend}
                                    onChange={(v) => { this.setState({ showLegend: v }) }}
                                />
                            </WeaFormItem>
                        </div>}
                </WeaSearchGroup>

                {showType == '0' && <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@3zaj0x`} title={getLabel('127253', '来源设置')} needTigger={true} showGroup={true} >
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@ojzhuc`} label={getLabel(524482, '公文类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@cha9hk`}
                            detailtype={3}
                            options={Object.keys(officalTypeOption).map(function (el) {
                                return { key: el, showname: officalTypeOption[el] };
                            })}
                            value={officalType}
                            onChange={value => {
                                this.setState({ officalType: value });
                            }}
                        />
                    </WeaFormItem>
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@33ge04`} label={getLabel(524483, '列表类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@414yoi`}
                            detailtype={3}
                            options={Object.keys(dealTypeOptions3).map(function (el) {
                                return { key: el, showname: dealTypeOptions3[el] };
                            })}
                            value={listType}
                            onChange={value => {
                                this.setState({ listType: value });
                            }}
                        />
                    </WeaFormItem>
                    {listType == '0' && <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@d8iuvb`} label={getLabel('17483', '查看类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@7fxg79`}
                            options={Object.keys(dealTypeOptions2).map(function (el) {
                                return { key: el, showname: dealTypeOptions2[el] };
                            })}
                            value={dealType}
                            onChange={value => {
                                this.setState({ dealType: value });
                            }}
                        />
                    </WeaFormItem>}
                    {listType == '1' ? <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@e0qypn`} label={getLabel('524311', '公文来源')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                        <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@93v9w2`}
                            options={dealTypeOptions4}
                            value={this.state.odocSource}
                            onChange={value => {
                                this.setState({ odocSource: value });
                            }}
                        />
                        {odocSource == '1' && <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@ce9t8n`}
                            style={{ marginTop: 10 }}
                            title={getLabel(386382, '请选择')}
                            type={'doccategory'}
                            isSingle={false}
                            replaceDatas={doccategoryNames}
                            onChange={(ids, names, datas) => {
                                this.setState({ doccategory: ids, doccategoryNames: datas });
                            }}
                            layout={document.body}
                            viewAttr={3}
                        />}
                    </WeaFormItem> :
                        <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@3dj01k`} label={getLabel('21672', '流程来源')} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
                            <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@hxiu8d`}
                                options={dealTypeOptions5}
                                value={this.state.workflowSource}
                                onChange={value => {
                                    this.setState({ workflowSource: value });
                                }}
                            />
                            {workflowSource == '1' && <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@9w9366`}
                                style={{ marginTop: 10 }}
                                viewAttr={3}
                                type={'odocFlow'}
                                title={getLabel(386382, '请选择')}
                                isSingle={false}
                                replaceDatas={workFlowIdName}
                                onChange={(ids, names, datas) => this.setState({ workFlowId: ids, workFlowIdName: datas })}
                                layout={document.body}
                            />}
                        </WeaFormItem>
                    }
                </WeaSearchGroup>}
            </WeaDialog>

        );
    }

    getButtons() {
        let buttons = [];
        buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@50xew4`} type="primary" onClick={this.onOk}>{getLabel(826, '确定')}</Button>);
        buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@tm7v4r`} type="ghost" onClick={this.onCancel}>{getLabel(31129, '取消')}</Button>);
        return buttons;
    }

    onChangeSize(string, value) {
        this.setState({
            [string]: value
        })
    }

    onDocSourceTypeChange(value, checked) {
        const { docSourceType } = this.state;
        const docSourceTypeArr = docSourceType.split(',');

        lodash.pull(docSourceTypeArr, value);
        if (checked) {
            docSourceTypeArr.push(value);
        }

        this.setState({ docSourceType: docSourceTypeArr.join(',') });
    }

    onOk() {
        if (!this.state.title || (this.state.listType == '0' && this.state.workflowSource == "1" && this.state.workFlowIdName.length == 0) ||
            (this.state.listType == '1' && this.state.odocSource == "1" && this.state.doccategoryNames.length == 0) ||
            (this.state.showType == '2' && this.state.workflowSource == "1" && this.state.workFlowIdName.length == 0) ||
            (this.state.showType == '1' && this.state.odocDateType == "") ||
            (this.state.showType == '0' && this.state.eFieldNewUsedKeys <= 0)) {
            message.warning(getLabel(15859, '必要信息不完整！'));
        } else {
            const { orderColDataSource: ds, orderColUsedKeys: keys, tableType } = this.state;

            const orderColUsed = [];
            for (let i = 0, len = keys.length; i < len; i++) {
                for (let j = 0, len2 = ds.length; j < len2; j++) {
                    if (keys[i] == ds[j].key) {
                        orderColUsed.push(ds[j]);
                    }
                }
            }
            console.log(...this.state)
            if (tableType == '6' || tableType == '7') {
                this.props.onOk({
                    ...this.state, orderColUsed, eFieldNewUsedKeys: ["7", "10", "11"]
                });
            } else this.props.onOk({
                ...this.state,
                orderColUsed,
                odocColorScheme: this.refs.odocColorScheme ? this.refs.odocColorScheme.state.value : '',
                odocLinkColorScheme: this.refs.odocLinkColorScheme ? this.refs.odocLinkColorScheme.state.value : ''
            });
        }
    }

    onCancel() {
        this.props.onCancel();
    }
}

export default Content_odocCenter_DataSource;
